package com.sealer.pattern.creational.factorymethod.factory;

import com.sealer.pattern.creational.factorymethod.service.Sender;
import com.sealer.pattern.creational.factorymethod.service.impl.MailSender;
import com.sealer.pattern.creational.factorymethod.service.impl.SmsSender;

/**
 * Created by sealer on 17/03/28.
 */
public class SenderFactory {
    public Sender newInstance(String type) throws Exception {
        if ("mail".equalsIgnoreCase(type)) {
            return new MailSender();
        } else if ("sms".equalsIgnoreCase(type)) {
            return new SmsSender();
        }

        return null;
    }
}
